<?php

namespace app\api\controller;
use app\api\validate\RefundValidate;
use app\api\logic\RefundLogic;

class RefundController extends BaseApiController
{
    /**
     * @notes 创建退款记录
     * @return \think\response\Json
     * @author dev
     * @date 2024/03/31 10:00
     */
    public function create()
    {
        $params = (new RefundValidate())->post()->goCheck('create');
        $params['user_id'] = $this->userId;
        $params['group_id'] = $this->userInfo['group_id'];
        $result = RefundLogic::create($params);
        if (true === $result) {
            return $this->success('已提交申请', [], 1, 1);
        }
        return $this->fail(RefundLogic::getError());
    }

    public function lists()
    {
        $params = $this->request->get();
        $params['group_id'] = $this->userInfo['group_id'];
        $result = RefundLogic::lists($params);
        return $this->data($result);
    }
}